<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>我的报备</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/api.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/aui.css" />
    <link rel="stylesheet" href="__CSS__/css/ydui.css">
    <link rel="stylesheet" href="__CSS__/css/demo_1.css">
    <style>
        .aui-bar-nav {
            background: #62C3D0;
        }

        .aui-bar-nav .aui-pull-left {
            padding-left: 10px;
        }

        .aui-iconfont-tu {
            min-height: 2.8rem;
            width: 1.5rem;
            background: url(__IMG__/back1.png) no-repeat center center;
            background-size: 44px 44px;
        }

        .aui-bar-nav .aui-title {
            left: 30px;
            right: 5px;
            padding-top: 0.85rem;
        }

        .label {
            width: 25%;
            line-height: 24px;
            height: 23px;
            background: rgba(255, 255, 255, 0.4);
            border-radius: 10px;
            /*margin-left: 8%;*/
            font-size: 16px;
            font-weight: 500;
            color: #FFFFFF;
        }
        #J_Address{
            padding: 0 5px;
        }
        .label_active {
            background: #FFFFFF;
            /*font-size: 12px;*/
            font-weight: 500;
            color: #62C3D0;
        }

        .all {
            padding: 0.8rem 0.75rem;
        }

        .box {
            background: #FFFFFF;
            box-shadow: 0px 2px 15px 0px rgba(236, 236, 236, 0.5);
            border-radius: 4px;
            padding-left: 0.55rem;
            padding-right: 0.6rem;
            margin-bottom: 0.75rem;
        }

        .top {
            padding-top: 0.55rem;
            padding-bottom: 0.85rem;
            font-size: 14px;
            font-weight: 400;
            color: #979797;
        }

        .person {
            font-size: 18px;
            font-weight: 400;
            color: #000000;
            align-items: center;
            margin-bottom: 0.4rem;
        }

        .avatar {
            width: 1.2rem;
            height: 1.2rem;
            margin-right: 0.2rem;
        }

        .arrow {
            width: 0.6rem;
            height: 0.6rem;
        }

        .center {
            margin-left: 0.9rem;
        }

        .status1 {
            font-size: 14px;
            font-weight: 400;
            color: #32C994;
        }

        .status2 {
            font-size: 14px;
            font-weight: 400;
            color: #62C3D0;
        }

        .status3 {
            font-size: 14px;
            font-weight: 400;
            color: #B2B2B2;
        }

        .btn {
            padding: 0.5rem 0;
        }

        .button {
            width: 3.25rem;
            height: 1.1rem;
            background: #62C3D0;
            border-radius: 12px;
            text-align: center;
            line-height: 1.1rem;
            font-size: 12px;
            font-weight: 500;
            color: #FFFFFF;
        }
        .red{
            font-size: 14px;color: red;
        }
        .ovfHiden{overflow: hidden;height: 100%;}
        .aui-title2{
            position: absolute;
            top:2.8rem;
            border:1px solid #ccc;
            border-radius: 5px;
            line-height: 40px;
            width:100px;
            text-align: center;
            letter-spacing: 5px;
            font-size: 16px;
            background-color: #FFF;
            padding-top: 10px;
            padding-bottom: 20px;
            z-index: 200;
        }
    </style>
</head>

<body id="body">
<header class="aui-bar aui-bar-nav underLine" id="header">
    <a class="aui-pull-left" tapmode="active" onclick="history.go(-1);"> <span class="aui-iconfont aui-iconfont-tu"> </span> </a>
    <div class="aui-title flex-wrap">
        <div data-id="4" class="fortype label {if $type == 4}label_active{/if}" style="margin-left: 3%">已加盟</div>
        <div data-id="1" class="fortype label {if $type == 1}label_active{/if}" style="margin-left: 8%;margin-right: 8%;">已报备</div>
        <div data-id="2" class="fortype label {if $type == 2}label_active{/if}">待更新</div>
        <!--<div data-id="3" class="fortype label {if $type == 3}label_active{/if}">待审核</div>-->
        <!--<div data-id="5" class="fortype label {if $type == 5}label_active{/if}">已过期</div>-->
        <!--<div class="label choiseType" style="padding: 0 10px">请选择类型</div>-->
        <!--<div class="label" id="J_Address" style="right: 0">全部区域</div>-->
    </div>
</header>
<header class="aui-bar aui-bar-nav underLine" style="margin-top: -0.8rem">
    <div class="aui-title flex-wrap">
        <!--<div data-id="1" class="fortype label {if $type == 1}label_active{/if}">已报备</div>-->
        <!--<div data-id="2" class="fortype label {if $type == 2}label_active{/if}">待更新</div>-->
        <!--<div data-id="3" class="fortype label {if $type == 3}label_active{/if}">待审核</div>-->
        <!--<div data-id="4" class="fortype label {if $type == 4}label_active{/if}">已加盟</div>-->
        <!--<div class="label choiseType" style="padding: 0 10px">请选择类型</div>-->
        <div data-id="3" class="fortype label {if $type == 3}label_active{/if}" style="margin-left: 3%">待审核</div>
        <div data-id="5" class="fortype label {if $type == 5}label_active{/if}" style="margin-left: 8%;margin-right: 8%;">已过期</div>
        <div class="label" id="J_Address" style="right: 0">全部区域</div>
    </div>
</header>
<!--<div class="aui-title aui-title2 hidden">-->
    <!--<div data-id="1" class="fortype {if $type == 1}label_active{/if}">已报备</div>-->
    <!--<div data-id="2" class="fortype {if $type == 2}label_active{/if}">待更新</div>-->
    <!--<div data-id="3" class="fortype {if $type == 3}label_active{/if}">待审核</div>-->
    <!--<div data-id="4" class="fortype {if $type == 4}label_active{/if}">已加盟</div>-->
    <!--<div data-id="5" class="fortype {if $type == 5}label_active{/if}">已过期</div>-->
<!--</div>-->
<div class="all">

</div>
<!--无内容-->
<div class="seat hidden" id="seatAll">
    <img src="__IMG__/quesheng/no_content.png" class="seatImg"/>
    <div class="seatName">没有符合条件的内容</div>
</div>
<input type="hidden" id="level" value="{$level}" />
<input type="hidden" id="type" value="{$type}" />
<input type="hidden" id="street" value="{$street}" />
<input type="hidden" id="myid" value="{$userInitInfo.user_id}" />
</body>
<div class="all_div" style="display:none;width: 100%;height: 100%;position: absolute;z-index: 100;background: rgba(0,0,0,0.5);top: 0;left: 0;"></div>
{include file="public/footer" /}
<script src="__JS__/js/ydui.citys.js"></script>
<script src="__JS__/js/ydui.js"></script>
<script type="text/javascript">
    $('.choiseType').click(function () {
        $('.aui-title2').removeClass('hidden');
        $('html,body').addClass('ovfHiden');
        $('.all_div').css('display','block');
    });
    $('.all_div').click(function () {
        $('.aui-title2').addClass('hidden');
        $('html,body').removeClass('ovfHiden');
        $('.all_div').css('display','none');
    });
    /**
     * 省市区街道四级联动
     * @type {*}
     */
    var $target = $('#J_Address');
    $target.citySelect();
    $target.on('click', function (event) {
        event.stopPropagation();
        $target.citySelect('open');
    });
    $target.on('done.ydui.cityselect', function (ret) {
        $(this).text(ret.city);
        $('#street').val(ret.id);
        initAjax();
    });

    initAjax();
    $('.fortype').click(function () {
        var type = $(this).attr('data-id');
        $('.fortype').removeClass('label_active');
        $(this).addClass('label_active');
        $('#type').val(type);
        initAjax();
    });
    function initAjax() {
        var type = $('#type').val();
        var level = $('#level').val();
        var street = $('#street').val();
        var myid = $('#myid').val();
        $.ajax({
            url:'{:url("My/mylistAjax")}',
            data:'type='+type+'&street=' + street+'&level=' + level,//
            type:'POST',
            dataType:'JSON',
            success: function(data){
                if(data.msg){
                    $('.all').empty();
                    $('#seatAll').addClass('hidden');
                    var datas = data.msg;
                    var ajaxType = $('#type').val();
                    $.each(datas,function(key,v){
                        var status_name = '';
                        if(v.s_status == 1){
                            if(ajaxType == 1){
                                status_name = '已报备';
                            }else if (ajaxType == 2){
                                status_name = '待更新';
                            }else{
                                if(v.s_verify == 1){
                                    status_name = '待审核';
                                }else if (v.s_verify == 2){
                                    status_name = '已报备'; //这个其实是报备已通过（但是走不到这里，除非显示所有会出现）
                                }else{
                                    status_name = '审核被拒';
                                }
                            }
                        }else if(v.s_status == 2){
                            status_name = '已加盟';
                        }else{
                            status_name = '已过期';
                        }
                        if(v.s_verify == 3){
                            var jj = v.s_reason+'（请重新报备）';
                        }else{
                            var jj = '';
                        }
                        if(v.s_verify == 2 && v.s_status == 1 && v.s_u_userid == myid){
                            var jj_down = '<div class="button" data-id="'+v.s_id+'">更新报备</div>';
                        }else{
                            var jj_down = '';
                        }
                        $(".all").append('' +
                            '<div class="box">'+
                                '<div class="top" data-id="'+v.s_id+'">' +
                                    '<div class="person flex-wrap">' +
                                        '<img src="__IMG__/people.png" class="avatar">' +
                                        '<div class="flex-con aui-ellipsis-1">'+v.s_com_name+'</div>' +
                                        '<img src="__IMG__/arrow.png" class="arrow">' +
                                    '</div>' +
                                    '<div class="flex-wrap">' +
                                        '<div>联系人：'+v.s_name+'</div>' +
//                                        '<div class="center">内部老师姓名：'+v.s_inside_name+'</div>' +
                                        '<div class="flex-con"></div>' +
                                        '<div class="status1">'+status_name+'</div>' +
                                    '</div>' +
                                    '<div class="flex-wrap">' +
                                        '<div style="margin-top: 5px;margin-bottom: -5px">内部老师姓名：'+v.s_inside_name+'</div>' +
                                    '</div>' +
                                '</div>' +
                                '<div class="btn flex-wrap topLine">' +
                                    '<div class="flex-con red">'+jj+'</div>'
                                    + jj_down +
                                '</div>' +
                            '</div>');
                    });
                    $('.top').click(function () {
                        var sid = $(this).attr('data-id');
                        window.location.href = '/index/My/info?sid=' + sid;
                    })
                    $('.button').click(function () {
                        var sid = $(this).attr('data-id');
                        window.location.href = '/index/My/update?sid=' + sid;
                    })
                }else{
                    $('.all').empty();
                    $('#seatAll').removeClass('hidden');
                }
            },
            error: function(xhr, type){
                alert('Ajax error!');
            }
        });
    }
</script>

</html>
